{{ $item := .item }}
{{ $widget := .widget }}
{{ $link := .link }}
{{ $target := .target }}
{{ $has_attachments := partial "functions/has_attachments" $item }}

{{/* Get summary. */}}
{{ $summary := "" }}
{{ if $item.Params.summary }}
  {{ $summary = $item.Params.summary | markdownify | emojify }}
{{ else if .Params.abstract }}
  {{ $summary = .Params.abstract | markdownify | emojify | truncate (site.Params.abstract_length | default 135) }}
{{ else if $item.Summary }}
  {{ $summary = $item.Summary }}
{{ end }}

{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }}
{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }}

<div class="project-card project-item isotope-item {{ $js_tag_classes | safeHTMLAttr }}">
  <div class="card">
    {{ with $resource }}
    {{ $image := .Resize "550x" }}
    <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="card-image hover-overlay">
      <img src="{{ $image.RelPermalink }}" alt="{{ $item.Title }}" class="img-responsive" loading="lazy">
    </a>
    {{ end }}
    <div class="card-text">
      <h4><a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4>

      {{ with $summary }}
      <div class="article-style">
        <p>{{ . }}</p>
      </div>
      {{ end }}

      {{ if $has_attachments }}
      <div class="btn-links">
        {{ partial "page_links" (dict "page" $item "is_list" 1) }}
      </div>
      {{ end }}
    </div>
  </div>
</div>
